package com.zcy.entity;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToOne;
import javax.persistence.Table;

import com.fasterxml.jackson.annotation.JsonIgnore;

@Entity
@Table(name="T_ENTITY_RELATIONSHIP_INFO")
public class EntityRelationshipInfo extends BaseEntity {

	private static final long serialVersionUID = 1L;

	/**
	 * 关联关系类型（1：一对一；2：一对多；3：多对多；4：多对一）
	 */
	private Integer type;

	/**
	 * 关联实体
	 */
	@JsonIgnore
	@ManyToOne(cascade = { CascadeType.REFRESH, CascadeType.MERGE }, optional = false)
    @JoinColumn(name = "ENTITY_ID")
	private EntityInfo entityInfo;
	
	@JsonIgnore
	@OneToOne(cascade = { CascadeType.REFRESH, CascadeType.MERGE }, optional = false)
    @JoinColumn(name = "DESC_ENTITY_PROPERTY_ID")
	private EntityProperty descProperty;
	
	@OneToOne(cascade = { CascadeType.REFRESH, CascadeType.MERGE }, optional = true)
    @JoinColumn(name = "TARGET_ENTITY_PROPERTY_ID")
	private EntityProperty targetProperty;

	public Integer getType() {
		return type;
	}

	public void setType(Integer type) {
		this.type = type;
	}

	public EntityInfo getEntityInfo() {
		return entityInfo;
	}

	public void setEntityInfo(EntityInfo entityInfo) {
		this.entityInfo = entityInfo;
	}

	public EntityProperty getDescProperty() {
		return descProperty;
	}

	public void setDescProperty(EntityProperty descProperty) {
		this.descProperty = descProperty;
	}

	public EntityProperty getTargetProperty() {
		return targetProperty;
	}

	public void setTargetProperty(EntityProperty targetProperty) {
		this.targetProperty = targetProperty;
	}
	
	

}
